package nina.yiyou.salary.input.util

import org.apache.poi.ss.usermodel.CellType
import org.apache.poi.xssf.usermodel.XSSFRow

class RowGroupValueGetter {

  RowGroupValueGetter(List<XSSFRow> group, int column) {
    _group = group
    _column = column
  }

  Object getValue() {
    return _group.collect { it.getCell(_column) }
        .findAll { it }
        .findAll { it.cellTypeEnum != CellType.BLANK }
        .collect { new CellValueGetter(it).get() }[0]
  }

  private final List<XSSFRow> _group

  private final int _column
}
